<template>
  <div>
    <van-search
      v-model="value"
      placeholder="请输入搜索关键词"
      @input="sousuo(value)"
    />
    <!--  -->
    <van-cell-group v-for="item in list" :key="item.street">
      <van-cell
        :title="item.communityName"
        @click="toh(item.communityName, item.community)"
      />
    </van-cell-group>
  </div>
</template>

<script>
import { Tosearch, Tosearchlist } from '@/api/user'
export default {
  name: 'ToSearch',
  props: {},
  components: {},
  data () {
    return {
      value: '',
      list: []
    }
  },
  methods: {
    async sousuo (value) {
      const res = await Tosearch(value)
      console.log(res)

      const res1 = await Tosearchlist(res.body.label, res.body.value)
      console.log(res1)
      this.list = res1.body
      console.log(this.list)
    },
    toh (val, val2) {
      this.$router.push({
        path: '/tohire',
        query: { val, val2 }
      })
    }
  }
}
</script>

<style scoped lang="less"></style>
